const cloud = require('wx-server-sdk')

cloud.init({
    env:"agriculture-4g9roniha194f9d1"
})
const db = cloud.database();

// 云函数入口函数
exports.main = async (event, context) => {
    const id = event.id

    return await db.collection("chatlist").where({
        'chat.$[].sendid':id
    }).update({
        data:{
            'chat.$[].state':true
        }
    })
}